<?php

function parseAmount($amount)
{
    $cnt = 0;
    $result = '';

    for($i = 1; $i <= ((strlen($amount) - 1) / 3) ; $i++)
    {
        $cnt++;
        $result = ',' . substr($amount, strlen($amount) - (($i) * 3), 3) . $result;
    }
    return substr($amount, 0, (strlen($amount) - (3 * $cnt))) . $result;
}
    
?>
